#ifndef FIFO_H
#define	FIFO_H

#include "WProgram.h"
#include "types.h"

/**
 * @brief declare constant for FIFO buffer maximum size limit
 */
#define fifo_max_array 100

/**
 * @brief declares structure for axis data for the controller
 */
struct axis_data
{
  CANON_PT x,y,z,a,b,c;  //change here
  int Speed;
};

/**
 * @brief define type buff_type for axis_data
 */
typedef axis_data buff_type;

/**
 * @brief declare variable for FIFO buffer max size required
 */
volatile extern int fifo_max_size;

/**
 * @brief declare variable for front and rear indices
 */
volatile extern int fifo_front,fifo_rear;

/**
 * @brief declare variable for count of elemnts in buffer
 */
volatile extern int fifo_count;

/**
 * @brief declare buffer
 */
extern buff_type fifo_data[fifo_max_array];

/**
 * @brief initialize buffer
 *
 * @param size size of the buffer
 */
void fifo_init(int size);

/**
 * @brief check if buffer is empty
 *
 * @return return TRUE if empty otherwise return FALSE
 */
bool fifo_isempty();

/**
 * @brief check if buffer is full
 *
 * @return return true if full otherwise FALSE
 */
bool fifo_isfull();

/**
 * @brief insert an element in buffer
 *
 * @param x element to be inserted
 */
void fifo_insert(buff_type x);

/**
 * @brief read an element from the buffer
 *
 * @return the element read
 */
buff_type fifo_read();

/**
 * @brief remove an element from the buffer
 *
 * @return the element removed
 */
buff_type fifo_remove();

/**
 * @brief obtain the current size of the buffer
 *
 * @return the size of the buffer
 */
int fifo_get_size();

#endif
